using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class PlayerStateBar : MonoBehaviour
{
    public Image healthImage;
    public Image healthDelayImage;
    public Image powerImage;
    public TextMeshProUGUI text;

    private void Update()
    {
        if(healthImage.fillAmount < healthDelayImage.fillAmount)
        {
            healthDelayImage.fillAmount -= Time.deltaTime;
        }
    }


    public void OnHealthChange(float presentage,float maxHealth,float currentHealth)
    {
        healthImage.fillAmount = presentage; 
        text.text = currentHealth.ToString() + "/" + maxHealth.ToString();
    }

    public void OnEnergyChange(float presentage) 
    {
        powerImage.fillAmount = presentage;
    }
}
